import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2023-08-02
 * Time: 17:20
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a= sc.next();
        String b= sc.next();
        if (a.length()==1 && b.length()==1 ){
            if (a.equals(b)){
                System.out.println(1);
            }else {
                System.out.println(0);
            }
        }
      else  if (a.length()==1 || b.length()==1){
            System.out.println(1);
        }
        else if (a.length()>= b.length()){
            int m=0;
            int n=0;
            for (int i = 0; i < b.length(); i++) {
                for (int j = i+1; j < b.length(); j++) {

                    if(a.contains(b.substring(i,j))){
                        if(i==0){
                            m=Math.max(j-i+1,m);
                        }else {
                            m=Math.max(j-i,m);
                        }
                    }


                }
            }
            System.out.println(m);
        }else {

            int m=0;
            int n=0;
            for (int i = 0; i < a.length(); i++) {
                for (int j = i+1; j < a.length(); j++) {

                    if(b.contains(a.substring(i,j))){
                       if(i==0){
                           m=Math.max(j-i+1,m);
                       }else {
                           m=Math.max(j-i,m);
                       }
                    }


                }
            }
            System.out.println(m);

        }
    }


}
